package cn.iocoder.yudao.module.system.dal.mysql.tenantType;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.type.TenantTypePageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.tenantType.TenantTypeDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 商户类型 Mapper
 *
 * @author sqalong
 */
@Mapper
public interface TenantTypeMapper extends BaseMapperX<TenantTypeDO> {

    default PageResult<TenantTypeDO> selectPage(TenantTypePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TenantTypeDO>()
                .likeIfPresent(TenantTypeDO::getName, reqVO.getName())
                .eqIfPresent(TenantTypeDO::getDescription, reqVO.getDescription())
                .eqIfPresent(TenantTypeDO::getStatus, reqVO.getStatus())
                .eqIfPresent(TenantTypeDO::getServiceFee, reqVO.getServiceFee())
                .betweenIfPresent(TenantTypeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(TenantTypeDO::getId));
    }

    default List<TenantTypeDO> selectListByStatus(Integer status) {
        return selectList(TenantTypeDO::getStatus, status);
    }
}
